﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Battle
{

    public static class EnemyFactory
    {
        private const string NormalPath = "Prefab/Enemy";

        //TODO 内存池
        private static Enemy_Num prefab_normal;
        public static EnemyBase CreateNormalEnemy(float x, float y, int hp, float speed)
        {
            return CreateNormalEnemy(new Vector3(x, y), hp, speed);
        }

        public static EnemyBase CreateNormalEnemy(Vector3 bornPos, int hp, float speed)
        {
            if (prefab_normal == null)
                prefab_normal = Resources.Load<Enemy_Num>(NormalPath);

            return MonoBehaviour.Instantiate(prefab_normal.gameObject).GetComponent<Enemy_Num>().InitEnemy(bornPos,hp,speed);
        }
    }

}